//
//  StrategyInlandJourneyTableViewCell.m
//  ITrip
//
//  Created by dllo on 15/5/29.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "StrategyInlandJourneyTableViewCell.h"

@implementation StrategyInlandJourneyTableViewCell

- (void)dealloc
{
    [self.InlandJourney_descriptionLabel release];
    [self.InlandJourney_nameLabel release];
    [self.InlandJourney_plan_days_countLabel release];
    [self.InlandJourney_plan_nodes_countLabel release];
    [self.InlandJourneyImageView release];
    [super dealloc];
}

- (void)setInlandJourneyModel:(StrategyInlandJourneyModel *)inlandJourneyModel
{
    self.InlandJourney_descriptionLabel.text = inlandJourneyModel.InlandJourney_description;
    self.InlandJourney_nameLabel.text = inlandJourneyModel.InlandJourney_name;
    self.InlandJourney_plan_days_countLabel.text = [NSString stringWithFormat:@"%ld天/", inlandJourneyModel.InlandJourney_plan_days_count];
    self.InlandJourney_plan_nodes_countLabel.text = [NSString stringWithFormat:@"%ld个旅行地", inlandJourneyModel.InlandJourney_plan_nodes_count];
    [self.InlandJourneyImageView setImageWithURL:[NSURL URLWithString:inlandJourneyModel.InlandJourney_image_url] placeholderImage:[UIImage imageNamed:@"defaultPicture"]];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createMyView];
    }
    return self;
}

- (void)createMyView
{
    self.InlandJourney_descriptionLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.InlandJourney_descriptionLabel];
    
    self.InlandJourneyImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.InlandJourneyImageView];
    
    self.InlandJourney_nameLabel = [[UILabel alloc]init];
    [self.InlandJourneyImageView addSubview:self.InlandJourney_nameLabel];
    
    self.InlandJourney_plan_days_countLabel = [[UILabel alloc]init];
    [self.InlandJourneyImageView addSubview:self.InlandJourney_plan_days_countLabel];
    
    self.InlandJourney_plan_nodes_countLabel = [[UILabel alloc]init];
    [self.InlandJourneyImageView addSubview:self.InlandJourney_plan_nodes_countLabel];
    
    [self.InlandJourney_descriptionLabel release];
    [self.InlandJourney_nameLabel release];
    [self.InlandJourney_plan_days_countLabel release];
    [self.InlandJourney_plan_nodes_countLabel release];
    [self.InlandJourneyImageView release];

}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.InlandJourneyImageView.frame = CGRectMake(0, 0, self.frame.size.width, 200);
    self.InlandJourneyImageView.backgroundColor = [UIColor colorWithRed:227/255.0 green:233/255.0 blue:240/255.0 alpha:1];
    
    self.InlandJourney_nameLabel.frame = CGRectMake(10, 160, 300, 20);
    self.InlandJourney_nameLabel.backgroundColor = [UIColor clearColor];
    self.InlandJourney_nameLabel.textColor = [UIColor whiteColor];
    self.InlandJourney_nameLabel.font = [UIFont boldSystemFontOfSize:17];
    
    self.InlandJourney_plan_days_countLabel.frame = CGRectMake(10, 180, 50, 20);
    self.InlandJourney_plan_days_countLabel.backgroundColor = [UIColor clearColor];
    self.InlandJourney_plan_days_countLabel.textColor = [UIColor whiteColor];
    self.InlandJourney_plan_days_countLabel.font = [UIFont boldSystemFontOfSize:17];
    
    self.InlandJourney_plan_nodes_countLabel.frame = CGRectMake(50, 180, 150, 20);
    self.InlandJourney_plan_nodes_countLabel.backgroundColor = [UIColor clearColor];
    self.InlandJourney_plan_nodes_countLabel.textColor = [UIColor whiteColor];
    self.InlandJourney_plan_nodes_countLabel.font = [UIFont boldSystemFontOfSize:17];
    
    self.InlandJourney_descriptionLabel.frame = CGRectMake(0, 200, self.frame.size.width, 80);
    self.InlandJourney_descriptionLabel.backgroundColor = [UIColor whiteColor];
    self.InlandJourney_descriptionLabel.numberOfLines = 3;
    self.InlandJourney_descriptionLabel.font = [UIFont systemFontOfSize:15];
    [self.InlandJourney_descriptionLabel sizeToFit];
    self.InlandJourney_descriptionLabel.textColor = [UIColor blackColor];

}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
